package com.hemerasolutions.v2trainer.controller;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.hemerasolutions.v2trainer.model.schedule.Cycle;
import com.hemerasolutions.v2trainer.model.schedule.CycleType;

@Controller
@ManagedBean(name="scheduleBean")
@Scope("view")
public class ScheduleBean implements Serializable {

	/**
	 * 
	 */
	
	private static final long serialVersionUID = 1L;
	private List<CycleType> cycleTypes;
	private CycleType cycleType;
	private Cycle selCycle;
	private int baseYear;
	
	private List<Cycle> cycles;
	
	
	public ScheduleBean() {
		super();
	}

	@PostConstruct
	public void init(){
		
		cycles = new ArrayList<Cycle>();
		
		
		
		for(int x = 0;x <= 10;x++){
			Cycle cycle = new Cycle("teste");
			
			for(int i = 0;i <= 52;i++){
				cycle.getSubCycles().add(new Cycle(String.valueOf(i)));
			}
			cycles.add(cycle);
		}
		
	}
	
	

	public void handleCycleType(ActionEvent ev){
		System.out.println("Cycletype Handler");
	}

	public void handleCycle(ActionEvent ev){
		System.out.println("Cycle Handler");
	}
	
	public List<CycleType> getCycleTypes() {
		return cycleTypes;
	}

	public void setCycleTypes(List<CycleType> cycleTypes) {
		this.cycleTypes = cycleTypes;
	}

	public int getBaseYear() {
		return baseYear;
	}

	public void setBaseYear(int baseYear) {
		this.baseYear = baseYear;
	}

	public CycleType getCycleType() {
		return cycleType;
	}

	public void setCycleType(CycleType cycleType) {
		this.cycleType = cycleType;
	}

	public Cycle getSelCycle() {
		return selCycle;
	}

	public void setSelCycle(Cycle selCycle) {
		this.selCycle = selCycle;
	}

	public List<Cycle> getCycles() {
		return cycles;
	}

	public void setCycles(List<Cycle> cycles) {
		this.cycles = cycles;
	}


	

}
